﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo
{
    class ArrayStatisticalMean
    {
        public static void Demo01()
        {
            int[] array;
            Console.WriteLine("请输入数组的长度：");
            int length = Convert.ToInt32(Console.ReadLine());
            array = new int[length];
            double sum = 0;
            double avg = 0;
            for (int i = 0; i < length; i++)
            {
                Console.Write("请输入第{0}个数组的值：", i);
                array[i] = Convert.ToInt32(Console.ReadLine());
            }
            Array.Sort(array);
            foreach (int i in array)

                Console.WriteLine("五名考生考试成绩分别为:" + i);

            foreach (double point in array)
            {
                sum = sum + point;
            }
            avg = sum / array.Length;
            Console.WriteLine("总成绩为：" + sum);
            Console.WriteLine("平均成绩为：" + avg);

        }
    }
}
